﻿@{
    ViewBag.Title = "发文管理";
    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}
@model IEnumerable<official_document>
@section styles{
    <link href="@Url.Content("~/Content/css/common/bootstrap/bootstrap.min.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/common/bootstrap-table/bootstrap-table.min.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/common/animate/animate.min.css")" rel="stylesheet" />

    <style type="text/css">
        .popover {
            height: 300px;
            width: 600px;
            overflow: hidden auto;
        }

        ul li {
            font-size: 11px;
        }
    </style>
}
<div id="dMain">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox" style="margin-bottom: 0px;">
            <div class="ibox-title">
                <h4>发文管理</h4>
            </div>
            <div class="ibox-content">
                @using(Html.BeginForm("Index","Send",FormMethod.Get))
                {
                <div class="dSearch">
                    <div>
                        <span>标题</span>@Html.Editor("SUBJECT", new { htmlAttributes = new { @class = "input normal form-control",style="width:120px;" } })
                        <span>文号</span>@Html.Editor("DOC_NUM", new { htmlAttributes = new { @class = "input normal form-control", style = "width:120px;" } })
                        <span>开始时间</span>@Html.Editor("M_START", new { htmlAttributes = new { @Class = "input form-control", style = "width:120px;", onfocus = "WdatePicker({ dateFmt: 'yyyy-MM-dd'})" } })
                        <span>结束时间</span>@Html.Editor("M_END", new { htmlAttributes = new { @Class = "input form-control", style = "width:120px;", onfocus = "WdatePicker({ dateFmt: 'yyyy-MM-dd'})" } })
                        <button type="submit" id="lbtnSearch" class="btn btn-sm btn-primary btn-success"><i class="iconfont icon-sousuo"></i>&nbsp;快速检索</button>
                    </div>
                </div>
                }
                <div class="bootstrap-table">
                    <div class="fixed-table-toolbar">
                        <div class="bs-bars pull-left">
                            <div id="toolbar">
                                <a class="btn btn-sm btn-success radius" onclick="parent.createTab('1301','新建发文','@Url.Action("Edit", "Send", new { area = "Document" })')" style="margin-top: 10px;"><i class="iconfont icon-tianjia"></i>&nbsp; 新建发文</a>
                                <div class="text-danger" style="font-size: 14px; margin-top: 15px;margin-left: 10px;float:right; "><i class="iconfont icon-tuichiweixuan"></i>&nbsp;提示：双击行可查看该信息的详细！</div>
                            </div>
                        </div><div class="columns columns-right btn-group pull-right"><button class="btn btn-sm btn-white" type="button" name="paginationSwitch" title="隐藏/显示分页"><i class="glyphicon glyphicon-collapse-down icon-chevron-down"></i></button><button class="btn btn-sm btn-white" type="button" name="refresh" title="刷新"><i class="glyphicon glyphicon-refresh icon-refresh"></i></button><div class="keep-open btn-group" title="列"><button type="button" class="btn btn-sm btn-white dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-th icon-th"></i> <span class="caret"></span></button><ul class="dropdown-menu" role="menu"><li><label><input type="checkbox" data-field="DRAFT_AUTHOR" value="1" checked="checked"> 拟稿人</label></li><li><label><input type="checkbox" data-field="RECEIVE_UNITS_TEXT" value="2" checked="checked"> 发送范围</label></li><li><label><input type="checkbox" data-field="SUBJECT" value="3" checked="checked"> 标题</label></li><li><label><input type="checkbox" data-field="DOC_NUM" value="4" checked="checked"> 文号</label></li><li><label><input type="checkbox" data-field="CREATE_TIME" value="5" checked="checked"> 发文时间</label></li><li><label><input type="checkbox" data-field="STATUS" value="6" checked="checked"> 发送状态</label></li><li><label><input type="checkbox" data-field="#" value="7" checked="checked"> 操作</label></li></ul></div><div class="export btn-group"><button class="btn btn-sm btn-white dropdown-toggle" title="Export data" data-toggle="dropdown" type="button"><i class="glyphicon glyphicon-export icon-share"></i> <span class="caret"></span></button><ul class="dropdown-menu" role="menu"><li data-type="json"><a href="javascript:void(0)">JSON</a></li><li data-type="xml"><a href="javascript:void(0)">XML</a></li><li data-type="csv"><a href="javascript:void(0)">CSV</a></li><li data-type="txt"><a href="javascript:void(0)">TXT</a></li><li data-type="sql"><a href="javascript:void(0)">SQL</a></li><li data-type="excel"><a href="javascript:void(0)">MS-Excel</a></li></ul></div></div>
                    </div>
                    <div class="fixed-table-container" style="padding-bottom: 0px;font-size:12px;">
                        <div class="fixed-table-header" style="display: none;">
                            <table></table>
                        </div><div class="fixed-table-body">
                            <div class="fixed-table-loading" style="top: 37px; display: none;">正在努力地加载数据中，请稍候……</div>
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th class="bs-checkbox " style="width: 36px;" data-field="0" tabindex="0">
                                            <div class="th-inner ">
                                                <input name="btSelectAll" type="checkbox">
                                            </div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">拟稿人</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">发送范围</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">标题</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">文号</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">发文时间</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; ">
                                            <div class="th-inner ">状态</div><div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle; " data-field="#" tabindex="0">
                                            <div class="th-inner ">操作</div><div class="fht-cell"></div>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @{
                                        foreach (var item in Model)
                                        {
                                    <tr>
                                        <td class="bs-checkbox "><input data-index="0" name="btSelectItem" type="checkbox"></td>
                                        <td style="text-align: center; ">@item.DRAFT_AUTHOR</td>
                                        <td style="text-align: center; ">@item.RECEIVE_UNITS_TEXT</td>
                                        <td style="text-align: center; ">
                                            @*<a href="#" onclick="parent.createTab('6202','公文详情','@Url.Action(" Details","Send",new { id=item.DOC_ID })')">@item.SUBJECT</a>*@
                                            <a href="#" onclick="parent.createTab('1303','公文详情','@Url.Action("Details", "Send", new { id=item.DOC_ID })')">@item.SUBJECT</a>
                                        </td>
                                        <td style="text-align: center; ">@(item.DOC_NUM ?? "-")</td>
                                        <td style="text-align: center; ">@item.SIGNATURE_TIME</td>
                                        <td id="td_status_@item.DOC_ID" style="text-align: center; ">
                                            @switch (item.STATUS)
                                            {
                                                case 0:
                                                    <span style="color:green;">已拟稿</span>
                                                    break;
                                                case 1:
                                                    <span style="color:red;"> 请求领导批示 </span>
                                                    break;
                                                case 2:
                                                    <span style="color:red;">批示未通过</span>
                                                    break;
                                                case 3:
                                                    <span style="color:green;">领导批示通过</span>
                                                    break;
                                                case 4:
                                                    <span style="color:red;">请求取文号</span>
                                                    break;
                                                case 5:
                                                    <span style="color:green;">已取文号</span>
                                                    break;
                                                case 6:
                                                    <span style="color:green;">自己已签章</span>
                                                    break;
                                                case 7:
                                                    <span style="color:red;">请求领导签章</span>
                                                    break;
                                                case 8:
                                                    <span style="color:green;">领导已签章</span>
                                                    break;
                                                case 9:
                                                    <span style="color:red;">已发送接收人</span>
                                                    break;
                                                case 10:
                                                    <span style="color:green;">已归档</span>
                                                    break;
                                            }
                                        </td>
                                        <td id="td_func_@item.DOC_ID" style="text-align: left; vertical-align: middle; ">
                                            @if (item.STATUS == 0 || item.STATUS == 2)
                                            {
                                                <a class="btn btn-info btn-xs btn-outline" onclick="parent.createTab('1301','编辑发文','@Url.Action("Edit","Send",new { id = item.DOC_ID })')"> 编辑</a>
                                                <a class="btn btn-danger btn-xs" onclick='del(this,"@item.DOC_ID")'>删除</a>
                                            }
                                            @*<a class="btn btn-info btn-xs btn-outline" target="_blank" href="/Document/FileView?url=/upload/201812/05/201812051605387136.jpg">在线预览</a>&nbsp;*@
                                            @switch (item.STATUS)
                                            {
                                                case 0:
                                                    <a class="btn btn-info btn-xs btn-outline" href="#" onclick="requestNextStep(@item.DOC_ID,@item.STATUS)">请求领导批示</a>
                                                    break;
                                                case 1:
                                                    if (item.DEPT_LEADER_USER_NO == (Session["UserInfo"] as user).USER_NO)
                                                    {
                                                        <a class="btn btn-info btn-xs btn-outline" onclick="parent.createTab('1303','公文批示','@Url.Action("Approval","Send",new { id = item.DOC_ID })')"> 批示</a>
                                                    }
                                                    break;
                                                case 3:
                                                    <a class="btn btn-info btn-xs btn-outline" onclick="selectDocNumberUser(@item.DOC_ID,@item.STATUS)">取文号</a>
                                                    break;
                                                case 4:
                                                    if (item.SIGNER_USER_NO == (Session["UserInfo"] as user).USER_NO)
                                                    {
                                                        <a class="btn btn-info btn-xs btn-outline" onclick="parent.createTab('1304','设置文号','@Url.Action("SetDocNumber","Send",new { id = item.DOC_ID })')"> 设置文号</a>
                                                    }
                                                    break;
                                                case 5:
                                                    <a class="btn btn-info btn-xs btn-outline" href="#" onclick="requestNextStep(@item.DOC_ID,@item.STATUS)">自己签章</a>
                                                    break;
                                                case 6:
                                                    <a class="btn btn-info btn-xs btn-outline" href="#" onclick="requestNextStep(@item.DOC_ID,@item.STATUS)">请求领导签章</a>
                                                    break;
                                                case 7:
                                                    if (item.DEPT_LEADER_USER_NO == (Session["UserInfo"] as user).USER_NO)
                                                    {
                                                        <a class="btn btn-info btn-xs btn-outline" href="#" onclick="requestNextStep(@item.DOC_ID,@item.STATUS)">签章</a>
                                                    }
                                                    break;
                                                case 8:
                                                    <a class="btn btn-info btn-xs btn-outline" href="#" onclick="sendDocument(@item.DOC_ID)">发送接收人</a>
                                                    break;
                                                case 9:
                                                    <a class="btn btn-info btn-xs btn-outline" tabindex="0" role="button" data-trigger="focus" data-toggle="popover" data-placement="left" data-html="true" title="签收情况" data-content='<ul style="width:600px;">
                                                                @foreach (var receiver in item.official_document_receives)
                                                                {
                                                                    if (receiver.STATUS == 0)
                                                                    {
                                                                        <li style="color:red;">@receiver.RECEIVER_NAME 未签收</li>
                                                                    }
                                                                    else
                                                                    {
                                                                        <li style="color:green;">@receiver.RECEIVER_NAME 已签收,签收时间：@receiver.RECEIVE_TIME</li>
                                                                    }
                                                                }
                                                             </ul>'>签收情况</a><text>&nbsp;</text>
                                                            <a class="btn btn-info btn-xs btn-outline" href="#" onclick="requestNextStep(@item.DOC_ID,@item.STATUS)">归档</a>
                                                            break;
                                                    }
                                        </td>
                                    </tr>
                                        }
                                    }
                                </tbody>
                            </table>
                        </div><div class="fixed-table-footer" style="display: none;"><table><tbody><tr></tr></tbody></table></div><div class="fixed-table-pagination" style="display: block;"><div class="pull-left pagination-detail"><span class="pagination-info">显示第 1 到第 @Model.Count() 条记录，总共 @Model.Count() 条记录</span><span class="page-list" style="display: none;">每页显示 <span class="btn-group dropup"><button type="button" class="btn btn-sm btn-white dropdown-toggle" data-toggle="dropdown"><span class="page-size">10</span> <span class="caret"></span></button><ul class="dropdown-menu" role="menu"><li><a href="javascript:void(0)">100</a></li></ul></span> 条记录</span></div><div class="pull-right pagination" style="display: none;"><ul class="pagination"><li class="page-pre"><a href="javascript:void(0)">‹</a></li><li class="page-number active"><a href="javascript:void(0)">1</a></li><li class="page-next"><a href="javascript:void(0)">›</a></li></ul></div></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
    <script src="@Url.Content("~/Content/JS/common/WdatePicker/WdatePicker.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap/bootstrap.min.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table.min.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/locale/bootstrap-table-zh-CN.min.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table-export.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/tableExport.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table-cookie.js")"></script>
    <script src="@Url.Content("~/Content/js/common/from.js")"></script>
    <script src="@Url.Content("~/Content/js/common/Date.js")"></script>

    <script src="@Url.Content("~/Content/js/common/signalR/jquery.signalR-2.4.0.min.js")"></script>
    <script src="@Url.Content("~/signalr/hubs")"></script>
    <script src="@Url.Content("~/Content/js/common/signalR/signalRContext.js")"></script>
    <script type="text/javascript">
        $(function () {
            $('[data-toggle="popover"]').popover();
        });

    //var tabHeight = 0;
        $(function () {
        $('#DocumentDataTable').bootstrapTable({
            //  height: tabHeight + 50,
            url: '/Document/Send/GetDataTableJsonResult',         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
            //data: $("#dJson").text() != "" ? JSON.parse($("#dJson").text()) : "",
            dataType: "json",
            columns: [

                { checkbox: true },
			    {
                                                            title: "拟稿人", field: 'DRAFT_AUTHOR', align: 'center'
                },
                {
                                                            title: "发送范围", field: 'RECEIVE_UNITS_TEXT', align: 'center'
                },
                {
                                                            title: "标题", field: 'SUBJECT', align: 'center'
                },
                {
                                                            title: "文号", field: 'DOC_NUM', align: 'center'
                },
                {
                                                            title: "发文时间", field: 'CREATE_TIME', align: 'center', formatter: function (value, row, index) {
                                                                    return new Date(value).Format("yyyy-MM-dd hh:mm:ss");
                                                                }
                                                            },
                {
                                                            title: "发送状态", field: 'STATUS', align: 'center',
                    formatter: function (value, row, index) {
                                                                    switch (value) {
                                                                        case 0:
                                                                            return "<span style='color:red;'>未发送</span>";
                                                                        case 1:
                                                                            return "<span style='color:green;'>已发送</span>";
                                                                    }
                                                                }
                                                            },
                {
                                                            field: '#',
                    title: "操作",
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                            var ids = row.DOC_ID;
                            var result = '<a class="btn btn-info btn-xs btn-outline" onclick="parent.createTab(\'1301\',\'编辑发文\',\'@Url.Action("Edit", "Send", new { area = "Document" })\/' + ids + '\')" > 编辑</a><a class="btn btn-danger btn-xs" onclick="del(' + ids + ')">删除</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" target="_blank" href="/Document/FileView?url=' + row.ATTACHMENT +'">在线预览</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" href="#">取文号</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" href="#">盖章</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" href="#">公文纠错</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" href="#">签收情况</a>&nbsp;<a class="btn btn-info btn-xs btn-outline" href="#">归档</a>';
                            return result;
                        }
                    }
            ],
            toolbar: '#toolbar',//工具按钮用哪个容器
            buttonsClass: "sm btn-white",//按钮class
            pageSize: 10,//分页条数
            clickToSelect: false,//设置true 将在点击行时，自动选择单选或复选框
            singleSelect: false,//为true则禁止多选
            cache: false,//是否缓存
            cookie: true,//是否启用cookie
            cookieIdTable: "Document",//cookie键值
            pagination: true,//是否分页
            showColumns: true,//是否显示所有的列
            showRefresh: true,//是否显示刷新按钮
            search: false,//是否启用搜索
            showPaginationSwitch: true,//是否显示分页切换按钮
            showExport: true,//是否启用导出
            striped: false,//是否显示行间隔色
            detailView: false,//是否显示切换视图列
            //detailFormatter: detailFormatter,//卡片视图内容格式化
            onDblClickRow: function (row, obj) { //双击行事件
                                                 // window.top.showFullPage("图像阅读器（" + (row.FileNo) + "）", "/See.aspx?FID=" + row.ID);
                                                                    parent.createTab('1303','发文明细','@Url.Action("DocumentDetails", "Send", new { area = "Document" })/' + row.EVECTION_ID + '');
                                                                },
            onClickRow: function (row, obj) { //单击行事件
                $(obj).parent().find("tr").removeClass("selected");
                $(obj).addClass("selected");

                ////根据选中的行获取子表数据
                //GetSonData(row.ID);
            },
            onSearch: function (text) {
                if (text != "") {
                    $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                        var str = "<span class=\"bg-yellow\">" + text + "</span>";
                        var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(text, str);
                        $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                    })
                }
            }
        });
    })

    //取文号，选择文号签发人
    function selectDocNumberUser(docId,status) {
            layer.open({
                type: 2,
                shadeClose: true,
                shade: 0.8,
                skin: 'layui-layer-rim', //加上边框
                area: ['80%', '90%'], //宽高
                content: '@Url.Action("SelectDocNumberUser", "Send", new { area = "Document" })\/' + docId + '?status=' + status
            });
        }

        //取文号，设置文号签发人
        function setDocNumberUser(data) {
            if (data.type == 1) {
                $.post("/Document/Send/SetSigner",
                    {
                        id: data.doc_id,
                        signerId: data.uid_list[0],
                        signerName: data.utext_list[0]
                    }, function (result) {
                        if (result.code == 100) {
                            console.log("签发人设置成功");
                            requestNextStep(data.doc_id, data.status);
                        }
                    });

                //(data.doc_id);
                //(data.status);
                //(data.uid_list[0]);
                //(data.utext_list[0]);
            }
        }

        function sendDocument(docId) {
            $.post("/Document/Send/SendDocument", { id: docId }, function (result) {
                if (result.code == 100) {
                    result.data.forEach(function (item, index) {
                        sendMessage(item,"official_document","收到新的公文","/document/receive/index",null);
                    });
                    requestNextStep(docId);
                }
            });
        }

        function requestNextStep(docId) {
            $.post("/Document/Send/RequestNextStep", { id: docId }, function (result) {
                var statusMessage = '<span></span>';
                if (result.code == 100) {
                    var newStatus = result.data.STATUS;
                    switch (newStatus) {
                        case 0:
                            statusMessage = '<span style="color:green;">已拟稿</span>';
                            break;
                        case 1:
                            sendMessage(result.data.DEPT_LEADER_USER_NO, "official_document", "公文请求批示", "/document/send/index", null);
                            statusMessage = '<span style="color: red;">请求领导批示</span>';
                            break;
                        case 2:
                            sendMessage(result.data.DRAFT_USER_NO, "official_document", "公文批示通知", "/document/send/index", null);
                            statusMessage = '<span style="color: red;">领导批示未通过</span>';
                            break;
                        case 3:
                            sendMessage(result.data.DRAFT_USER_NO, "official_document", "公文批示通知", "/document/send/index", null);
                            statusMessage = '<span style="color:green;">领导批示通过</span>';
                            break;
                        case 4:
                            sendMessage(result.data.SIGNER_USER_NO, "official_document", "请求取文号", "/document/send/index", null);
                            statusMessage = '<span style="color:red;">请求取文号</span>';
                            break;
                        case 5:
                            sendMessage(result.data.DRAFT_USER_NO, "official_document", "公文进度通知", "/document/send/index", null);
                            statusMessage = '<span style="color:green;">已取文号</span>';
                            break;
                        case 6:
                            statusMessage = '<span style="color:green;">自己已签章</span>';
                            break;
                        case 7:
                            sendMessage(result.data.DEPT_LEADER_USER_NO, "official_document", "公文请求签章", "/document/send/index", null);
                            statusMessage = '<span style="color:red;">请求领导签章</span>';
                            break;
                        case 8:
                            sendMessage(result.data.DRAFT_USER_NO, "official_document", "公文进度通知", "/document/send/index", null);
                            statusMessage = '<span style="color:green;">领导已签章</span>';
                            break;
                        case 9:
                            statusMessage = '<span style="color:red;">已发送接收人</span>';
                            break;
                        case 10:
                            statusMessage = '<span style="color:green;">已归档</span>';
                            break;
                    }
                    $("#td_status_" + docId).html(statusMessage);

                    var funcButtons = '';
                    switch (newStatus) {
                        case 0:
                            funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="requestNextStep(' + docId + ',' + newStatus + ')">请求领导批示</a>';
                            break;
                        case 3:
                            funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="selectDocNumberUser(' + docId + ',' + newStatus + ')">取文号</a>';
                            break;
                        case 5:
                            funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="requestNextStep(' + docId + ',' + newStatus + ')">自己签章</a>';
                            break;
                        case 6:
                            funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="requestNextStep(' + docId + ',' + newStatus + ')">请求领导签章</a>';
                            break;
                        case 8:
                            //funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="sendDocument(' + docId + ')">发送接收人</a>';
                            break;
                        case 9:
                            //funcButtons = '<a class="btn btn-info btn-xs btn-outline" onclick="requestNextStep(' + docId + ',' + newStatus + ')">归档</a>';
                            break;
                        default:
                            funcButtons = '';
                    }
                    console.log(funcButtons);
                    $("#td_func_" + docId).html(funcButtons);
                    console.log($("#td_func_" + docId).html());
                    layer.msg('请求已发送', {
                        icon: 1,
                        time: 2000//2s后自动关闭
                    });
                }
            });
        }

        function confirmRequestNextStep(docId, status) {
            var message = "是否确认请求下一步";
            switch (status) {
                case 0:
                    message = "是否确认请求领导批示？";
                    break;
                case 2:
                    message = "是否确认取文号？";
                    break;
                case 5:
                    message = "是否确认盖章？";
                    break;
                case 6:
                    message = "是否确认请求领导盖章？";
                    break;
                case 8:
                    message = "是否确认发送接收人？";
                    break;
                case 9:
                    message = "是否确认归档？";
                    break;
            }
            layer.confirm(message, {
                btn: ['确定', '取消'] //按钮
            }, function () {
                requestNextStep(docId);
            }, function () {

            });
        }

    function getName(arr, n, v) {
        for (var i = 0; i < arr.length; i++) {
            if (arr[i][n] == v) {
                return arr[i]["Text"];
            }
        }

    }

    function del(ele,id) {
        layer.confirm('是否删除此发文？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.post("/document/send/documentdelete", { id: id }, function (result) {
                $(ele).parent().parent().remove();
                layer.msg('删除发文成功！',{ icon: 1,
                    time: 2000//2s后自动关闭
                });
            });
        }, function () {

        });
    }
    </script>
}